# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=simtrace2
pkgver=1093.d0ad985
pkgrel=1
pkgdesc='Host utilities to communicate with SIMtrace2 USB Devices.'
arch=('x86_64' 'aarch64')
groups=('blackarch' 'blackarch-radio')
url='https://osmocom.org/projects/simtrace2/wiki'
license=('GPL')
depends=('libosmocore' 'libusb' 'pcsclite' 'talloc' 'lksctp-tools')
makedepends=('git' 'lksctp-tools')
source=('git+git://git.osmocom.org/simtrace2.git'
        '99-simtrace2.rules')
sha512sums=('SKIP'
            '7de2d855220f7320696e1a20a8c4b5cee4061915f35afa462d1f7c9333b11c5909c1c89ef816a8a90dffd7c9b37afb72614f1dc94f530230cc95c6a34d8ba07d')
install="$pkgname.install"

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd "$pkgname/host"

  autoreconf -fi
  ./configure
  make
}

package() {
  cd "$pkgname/host/src"

  install -Dm 755 -t "$pkgdir/usr/bin/" simtrace2-list simtrace2-sniff \
    simtrace2-cardem-pcsc simtrace2-tool

  cd $srcdir
  install -Dm 644 99-simtrace2.rules \
    "$pkgdir/etc/udev/rules.d/99-simtrace2.rules"

  cd $pkgname
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
}

